package com.mvp.shq.washer.entity;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/9/5.
 */

public class OrderInfo {

    /**
     * id : 0385c5ade43b43c98f8012fce4465e6e
     * createDate : 2017-09-05 15:51:23
     * updateDate : 2017-09-05 15:51:23
     * orderNo : O354654759736573952
     * userId : 1e8b5f1a89b1492095eabefd6e455222
     * washerId : 1c3df44bc3354ca7a4156b46f4431286
     * totalMoney : 0.01
     * status : 2
     * payStatus : 1
     * patternName : 快速
     * patternTime : 15
     * washerBrand : 小天鹅
     * washerSpecDes : 5斤
     */

    private String id;
    private String createDate;
    private String updateDate;
    private String orderNo;
    private String userId;
    private String washerId;
    private String washerNo;
    private BigDecimal totalMoney;
    private String status;
    private String payStatus;
    private String patternName;
    private int patternTime;
    private String washerBrand;
    private String washerSpecDes;
    private String washerAddress;
    private String photos;
    private String payType;
    private String[] photoList;
    private int progressTime;
    private int restTime;
    private BigDecimal patternPrice;
    private int errorFlag;//订单是否异常  0正在运行中  1发送异常  2订单已结束
    public static OrderInfo objectFromData(String str) {

        return new Gson().fromJson(str, OrderInfo.class);
    }

    public static List<OrderInfo> arrayOrderInfoFromData(String str) {

        Type listType = new TypeToken<ArrayList<OrderInfo>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCreateDate() {
        return createDate;
    }

    public void setCreateDate(String createDate) {
        this.createDate = createDate;
    }

    public String getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(String updateDate) {
        this.updateDate = updateDate;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getWasherId() {
        return washerId;
    }

    public void setWasherId(String washerId) {
        this.washerId = washerId;
    }

    public BigDecimal getTotalMoney() {
        return totalMoney;
    }

    public void setTotalMoney(BigDecimal totalMoney) {
        this.totalMoney = totalMoney;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getPayStatus() {
        return payStatus;
    }

    public void setPayStatus(String payStatus) {
        this.payStatus = payStatus;
    }

    public String getPatternName() {
        return patternName;
    }

    public void setPatternName(String patternName) {
        this.patternName = patternName;
    }

    public int getPatternTime() {
        return patternTime;
    }

    public void setPatternTime(int patternTime) {
        this.patternTime = patternTime;
    }

    public String getWasherBrand() {
        return washerBrand;
    }

    public void setWasherBrand(String washerBrand) {
        this.washerBrand = washerBrand;
    }

    public String getWasherSpecDes() {
        return washerSpecDes;
    }

    public void setWasherSpecDes(String washerSpecDes) {
        this.washerSpecDes = washerSpecDes;
    }

    public String getWasherAddress() {
        return washerAddress;
    }

    public void setWasherAddress(String washerAddress) {
        this.washerAddress = washerAddress;
    }

    public String getWasherNo() {
        return washerNo;
    }

    public void setWasherNo(String washerNo) {
        this.washerNo = washerNo;
    }

    public String getPhotos() {
        return photos;
    }

    public void setPhotos(String photos) {
        this.photos = photos;
    }

    public String[] getPhotoList() {
        String str[] = photos.split("\\|");
        for (int i = 0;i < str.length;i ++){
            str[i] = "http://www.uzhixi.com:8080"+str[i];
        }
        return str;
    }

    public int getProgressTime() {
        return patternTime - restTime;
    }

    public void setProgressTime(int progressTime) {
        this.progressTime = progressTime;
    }

    public int getRestTime() {

        return restTime <= 0?patternTime:restTime;
    }

    public void setRestTime(int restTime) {
        this.restTime = restTime;
    }

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    public void setPhotoList(String[] photoList) {
        this.photoList = photoList;
    }

    public BigDecimal getPatternPrice() {
        return patternPrice;
    }

    public void setPatternPrice(BigDecimal patternPrice) {
        this.patternPrice = patternPrice;
    }

    public int getErrorFlag() {
        return errorFlag;
    }

    public void setErrorFlag(int errorFlag) {
        this.errorFlag = errorFlag;
    }
}
